/**
 * 拍卖中心
 */
var LimitMap = Array(
		932200000,
		910340700,
		933000000,
		933030000,
		261000021,
		251010404,
		240080000,
		921160000,
		211000002,
		221023300);
var 老公老婆戒指 = Array(1112446, 1112447, 1112448, 1112449, 1112450, 1112451, 1112452, 1112453, 1112454, 1112455, 1112456, 1112457, 1112458, 1112459, 1112460, 1112461, 1112462, 1112463, 1112464, 1112465, 1112466, 1112467, 1112468, 1112469, 1112470, 1112471, 1112472, 1112473, 1112474, 1112475, 1112476, 1112477, 1112478, 1112479, 1112480, 1112481, 1112482, 1112483, 1112484, 1112485, 1112486, 1112487, 1112488, 1112489, 1112490, 1112491, 1112492, 1112493, 1112494, 1112495);

var npcid = Array(9001137, 9310605, 9310607, 9310608, 9310628, 9390382, 9390383, 2480007, 9400205);

var NPCzp = Array(2074137, 1540490, 9111007, 9400157, 9400158, 9400159, 9400373, 9400374, 9400437, 9400442, 9400439, 9400441, 9111064, 9400511, 9400459, 9400458);

var status = 0;
var aa1 = "#fEffect/CharacterEff/1051296/1/0#";
var aa3 = "#fEffect/CharacterEff/1112905/0/1#"; //小红心
var tz3 = "#fEffect/CharacterEff/1082588/0/0#"; //红点
var tz4 = "#fEffect/CharacterEff/1082588/3/0#"; //蓝点
var aaa73 = "#fUI/CashShop.img/CSEffect/hot/0#"; //人气图标

var a1 = "#fMap/MapHelper.img/weather/snowbear/3#"; //雪花


var a = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#";
var b = "#fUI/UIWindow/PartySearch2/BtNext/mouseOver/0#"; //箭头
var d = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/1#"; //红
var f = "#fUI/piggyBarMinigame.img/crunch/4#"; //红色星
var h = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/4#"; //绿
var i = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/5#"; //亲
var j = "#fEffect/CharacterEff/1114000/1/0#";
var k = "#fUI/piggyBarMinigame.img/crunch/5#"; //黄色粽
var l = "#fUI/Basic.img/BtMin2/normal/0#"; //箭头
var m = "#fUI/UIPVP.img/MiniMapIcon/star#"; //黄星星
var n = "#fUI/UIToolTip.img/Item/Equip/Star/Star1#"; //蓝星星
var o = "#fUI/UIWindow/Quest/icon7/10#"; ////红色圆
var p = "#fUI/UIWindow/Quest/icon8/0#"; ////蓝指标
var q = "#fEffect/CharacterEff/1112946/2/0#"; //砖石粉
var r = "#fEffect/CharacterEff/1112946/1/1#"; //砖石蓝
var s = "#fEffect/CharacterEff/1082565/0/0#"; //饼干兔子
var t = "#fEffect/CharacterEff/1112904/0/0#"; //彩色星星
var u = "#fEffect/CharacterEff/1003271/0/0#"; //红色心心
var v = "#fEffect/CharacterEff/1112946/4/1#"; //钻石
var w = "#fEffect/CharacterEff/1082229/0/0#"; //红心
var x = "#fUI/UIWindowTW.img/TimeCapsule/BtClose/disabled/0#"; //叉叉

var icon = Array(a, b, d, f, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x);
var UI0 = "#fEffect/CharacterEff/1051296/1/0#";
var UI1 = "#fEffect/CharacterEff/1051296/1/1#";
var UI2 = "#fEffect/CharacterEff/1051296/1/2#";
var UI3 = "#fEffect/CharacterEff/1051296/1/3#";
var UI4 = "#fEffect/CharacterEff/1051296/1/4#";
var UI5 = "#fEffect/CharacterEff/1051296/1/5#";
var 蓝星横条 = UI0 + UI1 + UI2 + UI3 + UI4 + UI5 + UI0 + UI1 + UI2 + UI3 + UI4 + UI5 + UI0 + UI1 + UI2 + UI3 + UI4;
var 小黄点 = "#fUI/UIPVP/MiniMapIcon/yellow#";

var messg = Array("游戏还愉快吗?",
		"如果有好的建议可以提供给管理员哦",
		"遇到BUG或者有什么建议可以在提交区提供信息哦",
		"杜绝一切外挂,wz等非法程序",
		"输入[@help]查看玩家指令,输入[@pm]可以快速打开拍卖",
		"如果好玩请带上你的朋友一起踏上冒险旅程吧");

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	var returnMap = cm.getSavedLocation("MULUNG_TC");
	var returnMap1 = cm.getSavedLocation("FREE_MARKET");
	if (returnMap <= 0) {
		returnMap = returnMap1;
	}
	if (returnMap1 <= 0) {
		returnMap = 100000000;
	}
	for (var key in LimitMap) {
		if (cm.getPlayer().getMapId() == LimitMap[key]) {
			cm.warp(returnMap);
			//cm.clearSavedLocation("MULUNG_TC");
			cm.showInstruction("基于游戏的平衡性\r\n刚才的地方无法使用菜单", 150, 7);
			cm.dispose();
			return;
		}
	}
	if (status == 0 && mode == 0) {
		cm.dispose();
		return;
	}
	if (mode == 1) {
		status++;
	} else {
		status--;
	}
	if (status == 0) {
		if (cm.getLevel() >= 60 && !cm.haveItem(1190400, 1, true, true)) { //检测背包或者身上有没有带有这个道具
			var toDrop = cm.getNewEquip(1190400);
			toDrop.setEnhance(25);
			cm.addFromDrop(toDrop);
			cm.sendOk("恭喜您获得25星的超强道具#i1190400#。助您打不动星之力地图的尴尬", npcid[Math.floor(Math.random() * npcid.length)]);
			cm.dispose();
			return;
		}

		if (!cm.haveItem(2432022, 1)) {//拍卖场专属使用卷
			cm.gainItem(2432022, 1);
		}
		if (!cm.haveItem(2430209, 1)) {//龙纹红包
			cm.gainItem(2430209, 1);
		}

		var selStr = "";
		selStr += "\t\t\t\t   #e#r" + cm.getServerName() + "拍卖#n#k \r\n \r\n";
		selStr += "		" + UI0 + UI0 + UI0 + UI0 + UI0 + "		" + UI0 + UI0 + UI0 + UI0 + UI0 + "\r\n";
		selStr += " #L1#" + 小黄点 + "#e#d自由市场#l#k";
		selStr += "#L100#" + 小黄点 + "#d角色信息#n#l#k   ";
		selStr += "#L3#新人福利#l";
		selStr += "#L9#更多功能#l\r\n";
		selStr += " #L2#" + 小黄点 + "#e#d万能传送#l#k";
		selStr += "#L8#" + 小黄点 + "#d" + (cm.isQuestFinished(1465) ? "五转中心#l   " : "快速转职#l   ") + "#n#k";
		selStr += "#L5#删除道具#l";
		selStr += "#L11#怪怪系统#l\r\n \r\n";
		selStr += "		" + UI0 + UI0 + UI0 + UI0 + UI0 + "		" + UI0 + UI0 + UI0 + UI0 + UI0 + "\r\n";
		selStr += " #L16#" + 小黄点 + "#e#g杂货商店#l";
		selStr += "#L21#" + 小黄点 + "兑换中心#n#l#k   ";
		selStr += "#L7##b消费商城#k#l";
		selStr += "#L4##b官方商城#k#l\r\n";
		selStr += " #L20#" + 小黄点 + "#e#g装备制作#l";
		selStr += "#L10#" + 小黄点 + "每日任务#n#k#l   ";
		selStr += "#L12##r#e[充值]赞助服务器!#l\r\n\r\n\r\n";
		selStr += "  #L1000#" + UI0 + UI0 + UI0 + UI0 + UI0 + "  #r#e提交问题!  " + UI0 + UI0 + UI0 + UI0 + UI0 + "#l\r\n";
		cm.sendSimple(selStr, npcid[Math.floor(Math.random() * npcid.length)]);
		
		//低级玩家欢迎语句，鼓励赞助；
		/*if (cm.getPlayer().getLevel() <= 150) {
			cm.getNpcNotice(NPCzp[Math.floor(Math.random() * NPCzp.length)], "#r" + cm.getChar().getName() + "很高兴见到你#k#l\r\n" + messg[Math.floor(Math.random() * messg.length)], 4);
		}*/
	} else if (status == 1) {
		switch (selection) {
		case 1: //自由市场
			if (cm.getPlayer().getMapId() >= 910000000 && cm.getPlayer().getMapId() <= 910000022) {
				cm.sendOk("你已经在自由市场了。", npcid[Math.floor(Math.random() * npcid.length)]);
			} else {
				cm.saveReturnLocation("FREE_MARKET");
				cm.warp(910000000, "st00");
			}
			cm.dispose();
			break;
		case 2: //地图传送
			cm.dispose();
			cm.openNpc(2023000, "地图传送");
			break;
		case 3: //福利中心
			cm.dispose();
			cm.openNpc(9010000, "福利中心");
			break;
		case 4: //进入商城
			cm.dispose();
		//	cm.playerMessage(-1, "暂未开放");
			cm.enterCS();
			break;
		case 5: //背包清理
			cm.dispose();
			cm.openNpc(9310362, "背包清理");
			break;
		case 6: //
			cm.dispose();
			cm.openNpc(9010047, "娱乐副本");
			break;
		case 7: //
			cm.dispose();
			cm.openNpc(1540517, "购物中心");
			break;
		case 8: //快速转职
			cm.dispose();
			cm.openNpc(9010047, "转职中心");
			//cm.openNpc(9010047, "快速转职");
			break;
		case 9: //实验室
			cm.dispose();
			cm.openNpc(9310476);
			break;
		case 10: //
			cm.dispose();
			cm.openNpc(9000156, "欢乐时间");
			break;
		case 11: //怪怪图鉴
			cm.dispose();
			cm.openUI(0x254);
			break;
		case 12: //充值理财
			cm.dispose();
			cm.openNpc(9100000, "理财系统");
			break;
		case 13: //点装回收
			cm.dispose();
			cm.openNpc(1012121, "点装回收");
			break;
		case 14: //背包清理
			cm.dispose();
			cm.openNpc(1012121, "背包清理");
			break;
		case 15: //积分兑换
			cm.dispose();
			cm.openNpc(2420039, "余额突破");
			break;
		case 16: //限制购买
			cm.dispose();
			cm.openNpc(9000231, 1); //游戏商店
			break;
		case 17: //装备回收
			cm.dispose();
			cm.openNpc(9310072, "装备回收");
			break;
		case 18: //BOSS传送
			cm.dispose();
			cm.openNpc(2023000, "BOSS传送");
			break;

		case 20: //制作大师
			cm.dispose();
			cm.openNpc(1203000, "制作大师");
			break;
		case 21: //兑换中心
			cm.dispose();
			cm.openNpc(9000231, "兑换中心");
			break;
		case 22: //自由转职
			cm.dispose();
			cm.openNpc(9900000, "自由转职")
		case 23: //综合排行
			cm.dispose();
			cm.openNpc(9040004, "综合排行");
			break;
		case 24: //飞升
			cm.dispose();
			cm.openNpc(9040004, "飞升");
			break;

		case 100: //个人信息
			cm.dispose();
			cm.openNpc(9310362, "个人信息");
			break;
		case 1000: //个人信息
			cm.dispose();
			cm.openNpc(9310362, "提交问题");
			break;
		default:
			cm.sendOk("该功能正在紧张进行制作中，请耐心等待。");
			cm.dispose();
			break;
		}
	}
}
